import java.util.ArrayList;
import java.util.Scanner;
import java.util.Stack;

/**
 * @Author @fiber-cloud
 * 牛客新手入门 10 11 17模块
 * @Date 2025/7/27 21:57
 */
public class NiuKe {
    //求阶乘
    public int factorialOfN (int n) {
        long sum = 1;
        final int di = 1_000_000_007;
        if (n == 1){
            return 1;
        }
        for (int i = 1; i <= n; i++) {
            sum = (sum * i)%di;
        }
        return (int) sum;
    }

    //凯撒解密
    public String decodeWangzai (String password, int n) {
        int s = n % 26;
        StringBuilder stringBuilder = new StringBuilder();
        for (char c : password.toCharArray()){
            int id = c - 'a';
            int new_id = (id - s + 26)%26;
            stringBuilder.append((char) ('a' +new_id));
        }
        return stringBuilder.toString();
    }

    //数字统计
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int x = 2;
        //在a-b范围内，2出现的次数
        int count = 0;
        String c = "";
        char d = Integer.toString(x).charAt(0);

        for (int i = a; i <= b; i++) {
            c = i+"";
            for (int j = 0; j < c.length(); j++) {
                if (c.charAt(j) == d){
                    count++;
                }
            }
        }
        System.out.println(count);
    }

    //两个数组的交集
    public ArrayList<Integer> intersection (ArrayList<Integer> nums1, ArrayList<Integer> nums2) {
        ArrayList<Integer> arrayList = new ArrayList<Integer>();

        for (int i = 0; i < nums1.size(); i++) {
            if (nums2.contains(nums1.get(i))){
                while (nums2.remove(nums1.get(i)));
                arrayList.add(nums1.get(i));
            }
        }
        return arrayList;
    }


    //点击消除
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        int length = s.length();

        StringBuilder stringBuilder = new StringBuilder(length);
        int index = -1;
        for (int i = 0; i < length; ++i) {
            char c = s.charAt(i);
            if (index == -1 || c != stringBuilder.charAt(index) ){
                stringBuilder.append(c);
                index++;
            }else {
                stringBuilder.deleteCharAt(index);
                index--;
            }
        }
        if(index==-1) {
            System.out.println("0");
        }else {
            System.out.println(stringBuilder);
        }
        scanner.close();
    }

}
